<?php
namespace Admin\Model;
use Think\Model;

/**
 * 员工MODEL类
 * User: xj
 * Date: 2015/3/23
 * Time: 17:44
 */
class StaffModel extends Model
{
/*
 *  获取员工数据
 * */
    public function getStaff($staffId,$page,$pageSize)
    {
        $map['state']=1;
        if($staffId)
        {
            if (is_array($staffId))
            {
                $map['staff_id'] = array('in', $staffId);
                return $this->where($map)->page($page,$pageSize)->select();
            }
            else
            {
                $map['staff_id'] = array('eq', $staffId);
                return $this->where($map)->page($page,$pageSize)->find();
            }
        }
        else
        {
           return  $this->where($map)->page($page,$pageSize)->order('order_id desc')->select();

        }

    }
/*
 *
 * 获取总数
 * */
    public function counts($map=NULL)
    {

        return $this->where($map)->count();

    }
}